<%@page import="java.util.ArrayList"%>
<%@page import="org.hibernate.Query"%>
<%@page import="org.hibernate.Transaction"%>
<%@page import="org.hibernate.Session"%>
<%@page import="org.hibernate.SessionFactory"%>
<%@page import="org.hibernate.cfg.Configuration"%>
<%
HttpSession session2=request.getSession();
String username=request.getParameter("username");
String password=request.getParameter("pwd");
Configuration cfg=new Configuration();
cfg.configure();
SessionFactory sf=cfg.buildSessionFactory();
Session ses=sf.openSession();
Transaction tx=ses.beginTransaction();
String Query="from User1 where uname= ? and password=?";
Query qe=ses.createQuery(Query);
qe.setString(0, username);
qe.setString(1, password);
ArrayList ar=(ArrayList)qe.list();
if(ar.size()>0){
session2.setAttribute("uname",username);
response.sendRedirect("/NewDon/Login/details.jsp");
}else{
session.setAttribute("uname", username);
session.setAttribute("password", password);
response.sendRedirect("/NewDon/Login/failuer.jsp");
}

%>